import Vue from "vue";
import App from "./App";
import store from "./store";
import { router, RouterMount } from "./router";
import uView from "uview-ui";
import { myTool } from "./utils/tool";
import { uviewConfig } from "@/const/application/uview.config";
import filters from "@/utils/filters";
import widget from "@/service/api/sp-common/widget";
import theme from "@/const/theme";
import xhImg from "./components/baseComponents/xh-img";
import cusTabBar from "./components/baseComponents/yqd-cus-tabbar";
import NavBar from "./components/baseComponents/nav-bar";
import XhEmpty from "./components/baseComponents/xh-empty";
import confirmModal from "./components/baseComponents/confirm-modal";
import modal from "./components/baseComponents/modal";

Vue.config.productionTip = false;
Vue.prototype.$myTool = myTool; //工具包
Vue.prototype.$store = store; //vuex
Vue.prototype.$widget = widget; //低代码相关接口
Vue.prototype.$theme = theme; //相关主题色，请看对应代码使用
App.mpType = "app";
Vue.component("xhImg", xhImg);
Vue.component("CusTabBar", cusTabBar);
Vue.component("NavBar", NavBar);
Vue.component("confirmModal", confirmModal);
Vue.component("modal", modal);
Vue.component("XhEmpty", XhEmpty);
Vue.use(router);
Vue.use(uView);

uni.$u.setConfig(uviewConfig);

//过滤器
Object.keys(filters).forEach((k) => Vue.filter(k, filters[k]));
const app = new Vue({
  store,
  ...App,
});
// app.$mount();

//v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
// #ifdef H5
RouterMount(app, "#app");
// #endif

// #ifndef H5
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
// #endif
export default app;
